'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	const collection = db.collection(event.t)
	const docList = await collection.where({_id:event._id}).get()
	if (!docList.data || docList.data.length === 0) {
		return {
			status: -1,
			// msg: event.t+'表内没有对应数据哦'
			msg: '当前数据无效'
		}
	}
	const res = await collection.doc(docList.data[0]._id).remove()
	if (res.deleted === 1) {
		return {
			status: 200,
			msg: '删除成功'
		}
	} else {
		return {
			status: -2,
			msg: '删除失败'
		}
	}
};
